<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>添加茶品 - 茶韵小铺管理后台</title>
    <link rel="stylesheet" href="css/style.css">
    <style>
        .form-group {
            margin-bottom: 15px;
        }
        .form-control {
            width: 100%;
            padding: 8px;
            margin-top: 5px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .submit-btn {
            background-color: #4CAF50;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .cancel-btn {
            background-color: #f44336;
            color: white;
            padding: 10px 15px;
            text-decoration: none;
            border-radius: 4px;
            margin-left: 10px;
        }
    </style>
</head>
<body>
    <nav class="header">
        <div class="nav-container">
            <h1 class="logo">茶韵小铺 - 管理员</h1>
            <div class="nav-links">
                <a href="/admin-dashboard.jsp">控制台</a>
                <a href="/admin-product-add.jsp">添加茶品</a>
                <a href="/logout">退出登录</a>
            </div>
        </div>
    </nav>

    <div class="container">
        <div class="auth-container">
            <h2 class="auth-title">添加新茶品</h2>
            <c:if test="${not empty errorMsg}">
                <div class="error-msg">${errorMsg}</div>
            </c:if>
            <form action="/admin/product/add" method="post" class="auth-form">
                <div class="form-group">
                    <label for="name">茶品名称：</label>
                    <input type="text" id="name" name="name" class="form-control" required>
                </div>
                <div class="form-group">
                    <label for="price">价格：</label>
                    <input type="number" id="price" name="price" step="0.01" min="0.01" class="form-control" required>
                </div>
                <div class="form-group">
                    <label for="description">描述：</label>
                    <textarea id="description" name="description" class="form-control" rows="4"></textarea>
                </div>
                <div class="form-group">
                    <label for="categoryId">类别ID：</label>
                <select id="categoryId" name="categoryId" class="form-control" required>
                    <option value="1">绿茶</option>
                    <option value="2">红茶</option>
                    <option value="3">白茶</option>
                    <option value="4">花茶</option>
                </select>
                </div>
                <div class="form-group">
                    <label for="mainImage">图片URL：</label>
                <input type="text" id="mainImage" name="mainImage" class="form-control" required>
                </div>
                <div class="form-group">
                    <label for="stock">库存数量：</label>
                    <input type="number" id="stock" name="stock" class="form-control" min="0" required>
                </div>
                <button type="submit" class="submit-btn">添加茶品</button>
                <a href="/admin-dashboard.jsp" class="cancel-btn">取消</a>
            </form>
        </div>
    </div>
</body>
</html>